#!/usr/bin/env python
# encoding: utf-8
'''
Ui.TaskBarIcon -- shortdesc

Ui.TaskBarIcon is a description

It defines classes_and_methods

@author:     Anson Chan

@copyright:  2016 Xerland Co. Ltd. All rights reserved.

@contact:    anson_chan@xerland.com
@deffield    updated: Updated
'''

import wx
class TaskBarIcon(wx.TaskBarIcon):
    ID_Exit = wx.NewId()
    def __init__(self, frame):
        wx.TaskBarIcon.__init__(self)
        self.frame = frame
        self.SetIcon(wx.Icon(name='res/TPlus.ico', type=wx.BITMAP_TYPE_ICO), 'TPlus')
        self.Bind(wx.EVT_MENU, self.OnExit, id=self.ID_Exit)

    def OnExit(self, event):
        self.frame.OnClose(self.frame)

    # override
    def CreatePopupMenu(self):
        menu = wx.Menu()
        menu.Append(self.ID_Exit, 'Exit')
        return menu
        